home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
earcd
/
util
/
wb
/
sysi2.lha
/
bitmap.c
next >
Wrap
C/C++ Source or Header
|
1997-02-11
|
991b
|
57 lines
#include "sysi2.h"
struct BitMap *MyAllocBM(LONG Width, LONG Height, LONG Depth, LONG Flags, struct BitMap *Friend)
{
if(IntuitionBase->LibNode.lib_Version>=39)
{
return(AllocBitMap(Width,Height,Depth,Flags,Friend));
}
else
{
struct BitMap *bm;
LONG l,fail=0;
if(bm=AllocVec(sizeof(struct BitMap),MEMF_PUBLIC|MEMF_CLEAR))
{
InitBitMap(bm,Depth,Width,Height);
Width=bm->BytesPerRow * 8;
for(l=0;l<Depth;l++)
{
if((bm->Planes[l]=AllocRaster(Width,Height))==0)
fail=1;
}
if(fail)
{
MyFreeBM(bm);
return(0);
}
return(bm);
}
}
}
void MyFreeBM(struct BitMap *BM)
{
LONG l;
if(BM)
{
if(IntuitionBase->LibNode.lib_Version>=39)
{
FreeBitMap(BM);
}
else
{
for(l=0;l<BM->Depth;l++)
{
if(BM->Planes[l])
FreeRaster(BM->Planes[l],BM->BytesPerRow,BM->Rows);
}
FreeVec(BM);
}
}
}